//-----------------------------------------------------------------------
// <copyright file="tblFileUploadService.cs" company="Cyvee">
//     Copyright ? Cyvee. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using Scb.Framework;
using Robot.Entities;
using Robot.Data;

namespace Robot.Business
{
  /// <summary>
  /// 
  /// </summary> 
  public class tblFileUploadService
  {
    #region My store procedure

    public static tblFileUpload GettblFileUploadByFileName(string sFileName, string peoplewise)
    {
      try
      {
        tblFileUploadDAO tblFileUploadDAO = new tblFileUploadDAO();
        return tblFileUploadDAO.GettblFileUploadByFileName(sFileName, peoplewise);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblFileUploadListException, ex);
      }
    }

    public static tblFileUploadCollection GetRateFileByCreatedDate(DateTime fromDate, DateTime toDate, string peoplewise)
    {
      try
      {
        tblFileUploadDAO tblFileUploadDAO = new tblFileUploadDAO();
        return tblFileUploadDAO.GetRateFileByCreatedDate(fromDate, toDate, peoplewise);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblFileUploadListException, ex);
      }
    }

    public static tblFileUploadCollection GetPDFFileByCreatedDate(DateTime from, DateTime to, string peoplewise)
    {
      try
      {
        tblFileUploadDAO tblFileUploadDAO = new tblFileUploadDAO();
        return tblFileUploadDAO.GetPDFFileByCreatedDate(from, to, peoplewise);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblFileUploadListException, ex);
      }
    }

    public static void DeletetblFileUpload(string peoplewise)
    {
      try
      {
        tblFileUploadDAO tblFileUploadDAO = new tblFileUploadDAO();
        tblFileUploadDAO.DeletetblFileUpload(peoplewise);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessDeletetblFileUploadException, ex);
      }
    }

    #endregion


    #region tblFileUpload

    public static void CreatetblFileUpload(tblFileUpload tblFileUpload)
    {
      try
      {
        tblFileUploadDAO tblFileUploadDAO = new tblFileUploadDAO();
        tblFileUploadDAO.CreatetblFileUpload(tblFileUpload);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessCreatetblFileUploadException, ex);
      }
    }

    public static void UpdatetblFileUpload(tblFileUpload tblFileUpload)
    {
      try
      {
        tblFileUploadDAO tblFileUploadDAO = new tblFileUploadDAO();
        tblFileUploadDAO.UpdatetblFileUpload(tblFileUpload);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessUpdatetblFileUploadException, ex);
      }
    }

    public static void DeletetblFileUpload(Guid id)
    {
      try
      {
        tblFileUploadDAO tblFileUploadDAO = new tblFileUploadDAO();
        tblFileUploadDAO.DeletetblFileUpload(id);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessDeletetblFileUploadException, ex);
      }
    }

    public static tblFileUpload GettblFileUpload(Guid id)
    {
      try
      {
        tblFileUploadDAO tblFileUploadDAO = new tblFileUploadDAO();
        return tblFileUploadDAO.GettblFileUpload(id);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblFileUploadException, ex);
      }
    }

    public static tblFileUploadCollection GettblFileUploadList(tblFileUploadColumns orderBy, OrderDirection orderDirection)
    {
      try
      {
        tblFileUploadDAO tblFileUploadDAO = new tblFileUploadDAO();
        return tblFileUploadDAO.GettblFileUploadList(orderBy, orderDirection);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblFileUploadListException, ex);
      }
    }

    public static tblFileUploadCollection GettblFileUploadList(tblFileUploadColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
    {
      try
      {
        tblFileUploadDAO tblFileUploadDAO = new tblFileUploadDAO();
        return tblFileUploadDAO.GettblFileUploadList(orderBy, orderDirection, page, pageSize, out totalRecords);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblFileUploadListException, ex);
      }
    }

    #endregion
  }
}